<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>html5绘画</title>
    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/weui/2.4.4/style/weui.min.css
    ">
    <!-- <script defer src="https://cdn.bootcdn.net/ajax/libs/three.js/r128/three.min.js"></script> -->
    <script src="./1.js" async></script>
    <script src="./2.js" async></script>
    <!-- <script src="./1.js" defer></script>
    <script src="./2.js" defer></script> -->

    <!-- 前端性能优化问题 script标签不应该放在一起 天生具有堵塞问题-->
    <!-- defer延迟执行,且是顺序执行 在DOMContentLoaded之前触发-->
    <!-- script标签 会阻塞，defer async 不阻塞 
    defer 会在DOMContentLoaded周期前按编写顺序执行
    async 允许并行 会在最后按加载速度顺序执行（先加载先执行）
    -->
    <style>
        #canvas{
            background-color: #000;
        }
    </style>
</head>
<body>
    <h1>Today is funny</h1>
    <script>
        console.log('阻塞');
    </script>
    <canvas id="canvas" width="400" height="400"></canvas>
    <script>
        document.addEventListener('DOMContentLoaded',function(){
            console.log('DOMContentLoaded');
        })
    </script>
    <script>
        var canvas=document.getElementById('canvas');   // 标签对象 canvas做游戏
        var context=canvas.getContext('2d'); //平面，WebGL是3d 上下文句柄

        context.beginPath();  // 开始路径
        //画line circle
        context.arc(100,100,50,0,Math.PI*2,true);//
        context.closePath();  // 结束路径
        context.fillStyle='rgb(255,255,255)';
        context.fill();
    </script>
    
</body>
</html>